﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.EquipmentManagement;

namespace Digitalmes.Model.EquipmentManagement
{
    /// <summary>
    /// 报警记录
    /// </summary>
	[Table("EquipmentAlarmRecord")]

    [Display(Name = "_Model.EquipAlarmRecord")]
    public class EquipmentAlarmRecord : TopBasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._EquipAlarmRecord._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._ProductId")]
        [Comment("产品号")]
        public long? ProductId { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._Equipment")]
        [Comment("设备")]
        public Equipment Equipment { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._Equipment")]
        [Comment("设备")]
        public long? EquipmentId { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._EquipCode")]
        [Comment("设备编号")]
        public string EquipCode { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._EquipName")]
        [Comment("设备名称")]
        public string EquipName { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._OpCode")]
        [Comment("工位")]
        public string OpCode { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._Address")]
        [Comment("报警地址")]
        public string Address { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._Bits")]
        [Comment("位")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public int? Bits { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._Content")]
        [Comment("报警内容")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Content { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._Level")]
        [Comment("报警级别")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public AlarmLevelEnum? Level { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._Classify")]
        [Comment("报警分类")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public AlarmTypeEnum? Classify { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._StartTime")]
        [Comment("开始时间")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public DateTime? StartTime { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._EndTime")]
        [Comment("结束时间")]
        public DateTime? EndTime { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._Duration")]
        [Comment("警报时长(分钟)")]
        [Precision(18,2)]
        public decimal? Duration { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._Status")]
        [Comment("报警状态")]
        public AlarmStatusEnum? Status { get; set; }
        [Display(Name = "_Model._EquipAlarmRecord._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
